Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Language Guide / Part 1 - Introducing AppleScript
Chapter 2 - Overview of AppleScript / Other Features and Language Elements


Identifiers

An identifier is a series of characters that identifies a value or other language element. For example, variable names are identifiers. In the following statement, the variable name myName identifies the value "Fred".

set myName to "Fred"
Identifiers are also used as labels for properties and handlers. You'll learn about these uses later in this guide.

An identifier must begin with a letter and can contain uppercase letters, lowercase letters, numerals (0-9), and the underscore character (_). Here
are some examples of valid identifiers:

Yes
Agent99
Just_Do_It 
The following are not valid identifiers:

C--
Back&Forth
999
Why^Not
Identifiers whose first and last characters are vertical bars (|) can contain any characters. For example, the following are legal identifiers:

|Back and Forth|
|Right*Now!| 
Identifiers whose first and last characters are vertical bars can contain additional vertical bars if the vertical bars are preceded by backslash (\) characters, as in the identifier |This\|Or\|That|. A backslash character in an identifier must be preceded by a backslash character, as in the identifier |/\\ Up \\/ Down|.

AppleScript identifiers are not case sensitive. For example, the variable identifiers myvariable and MyVariable are equivalent.

Identifiers cannot be the same as any reserved words--that is, words in the system dictionary or words in the dictionary of the application named in the Tell statement. For example, you cannot create a variable whose identifier is Yes within a Tell statement to the Scriptable Text Editor, because Yes is a constant from the Scriptable Text Editor dictionary. In this case, AppleScript returns a syntax error if you use Yes as a variable identifier.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996